package leetcode.code0537;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public class Solution implements IDebug {
	public String complexNumberMultiply(String num1, String num2) {
		String[] ab = this.split(num1);
		String[] cd = this.split(num2);
		int a = Integer.valueOf(ab[0]);
		int b = Integer.valueOf(ab[1]);
		int c = Integer.valueOf(cd[0]);
		int d = Integer.valueOf(cd[1]);
		return (a * c - b * d) + "+" + (b * c + a * d) + "i";
	}

	private String[] split(String num1) {
		num1 = num1.substring(0, num1.length() - 1);
		return num1.split("[+]");
	}

	@Override
	public void debug1() {
		HelpDebug.compare("0+2i", this.complexNumberMultiply("1+1i", "1+1i"));

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
//		"1+1".split("+");
	}

}
